package com.wdz.article.service.impl;

import com.wdz.article.entity.Article;
import com.wdz.article.mapper.ArticleMapper;
import com.wdz.article.service.IArticleService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 文章列表 服务实现类
 * </p>
 *
 * @author 吴传逞
 * @since 2020-11-04
 */
@Service("ArticleServiceImpl")
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements IArticleService {

    @Resource
    private ArticleMapper articleMapper;

    @Override
    public Map<String,Object> selectPreAndNextById(String id) {
        Map<String,Object> map = new HashMap<>();
        Article article = articleMapper.selectPreArticleById(id);
        map.put("pre",article == null ?"没有了":article);
        article = articleMapper.selectNextArticleById(id);
        map.put("next",article == null ?"没有了":article);
        return map;
    }
}
